package com.company.project.controller;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.company.project.common.aop.annotation.LogAnnotation;
import io.swagger.annotations.Api;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.stereotype.Controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import java.util.List;
import com.company.project.common.utils.DataResult;

import com.company.project.entity.TThjlmxEntity;
import com.company.project.service.TThjlmxService;



/**
 * 
 *
 * @author wenbin
 * @email *****@mail.com
 * @date 2023-11-06 22:00:27
 */
@Controller
@Api(tags = "外呼管理-通话明细记录")
@RequestMapping("/")
public class TThjlmxController {
    @Autowired
    private TThjlmxService tThjlmxService;


    /**
    * 跳转到页面
    */
    @GetMapping("/index/tThjlmx")
    public String tThjlmx() {
        return "tthjlmx/list";
        }

    @ApiOperation(value = "新增")
    @LogAnnotation(title = "外呼管理-通话明细记录", action = "新增")

    @PostMapping("tThjlmx/add")
    @RequiresPermissions("tThjlmx:add")
    @ResponseBody
    public DataResult add(@RequestBody TThjlmxEntity tThjlmx){
        tThjlmxService.save(tThjlmx);
        return DataResult.success();
    }

    @ApiOperation(value = "删除")
    @LogAnnotation(title = "外呼管理-通话明细记录", action = "删除")
    @DeleteMapping("tThjlmx/delete")
    @RequiresPermissions("tThjlmx:delete")
    @ResponseBody
    public DataResult delete(@RequestBody @ApiParam(value = "id集合") List<String> ids){
        tThjlmxService.removeByIds(ids);
        return DataResult.success();
    }

    @ApiOperation(value = "更新")
    @PutMapping("tThjlmx/update")
    @LogAnnotation(title = "外呼管理-通话明细记录", action = "更新")
    @RequiresPermissions("tThjlmx:update")
    @ResponseBody
    public DataResult update(@RequestBody TThjlmxEntity tThjlmx){
        tThjlmxService.updateById(tThjlmx);
        return DataResult.success();
    }

    @ApiOperation(value = "查询分页数据")
    @PostMapping("tThjlmx/listByPage")
    @LogAnnotation(title = "外呼管理-通话明细记录", action = "查询分页数据")
    @ResponseBody
    public DataResult findListByPage(@RequestBody TThjlmxEntity tThjlmx){
        Page page = new Page(tThjlmx.getPage(), tThjlmx.getLimit());
        return tThjlmxService.listByPage(page, tThjlmx);
    }
    @ApiOperation(value = "查询初始化选项")
    @LogAnnotation(title = "外呼管理-通话明细记录", action = "查询初始化选项")
    @GetMapping("tThjlmx/infoData")
    //@RequiresPermissions("tHwtj:list")
    @ResponseBody
    public DataResult infoData(){
        return tThjlmxService.infoData();
    }


    @GetMapping("tThjlmx/test")
    //@RequiresPermissions("tHwtj:list")
    @ResponseBody
    public DataResult test(){
        return tThjlmxService.test();
    }

}
